package ex4;
import java.lang.Comparable;
public class Question implements Complexity, Comparable<Question> {
	private int id;
	private int complexity;
	private String question;
	private String answer;
	
	public String getQuestion() {
		return this.question;
	}
	public String getAnswer() {
		return this.answer;
	}
	public boolean answerCorrect(String answer1) {
		if(answer1.compareTo(this.answer) == 0)
			return true;
		return false;
	}
	public String toString() {
		return "Quiz " + this.id + "\tQuestion: "+ this.question + "\n"; 
	}
	public Question() {
		this.id = 0;
		this.complexity = 0;
		this.question = null;
		this.answer = null;
	}
	
	public Question(int id, int complexity, String question, String answer) {
		this.id = id;
		this.complexity = complexity;
		this.question = question;
		this.answer = answer;
	}
	@Override
	public int getComplexity() {
		// TODO Auto-generated method stub
		return this.complexity;
	}

	@Override
	public void setComplexity(int value) {
		this.complexity = value;
		
	}
	public int getId() {
		return this.id;
	}
	public void setId(int value) {
		this.id = value;
	}
	@Override
	public int compareTo(Question o) {
		if(this.getComplexity() > o.getComplexity())
			return 1;
		else
			return -1;
	}
}
